package com.xbongbong.pro.message.enums;

import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author LiZhikang
 * @date 2022/11/7 19:37
 */
@Getter
@AllArgsConstructor
public enum PushParentTypeEnum {
    /**
     * CRM
     */
    CUSTOMER(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getAlias()),
    CUSTOMER_REMIND(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.CUSTOMER_REMIND.getCode(), XbbRefTypeEnum.CUSTOMER_REMIND.getAlias()),
    CONTACT(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.CONTACT.getCode(), XbbRefTypeEnum.CONTACT.getAlias()),
    OPPORTUNITY(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), XbbRefTypeEnum.SALES_OPPORTUNITY.getAlias()),
    COMMUNICATE_PLAN(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(), XbbRefTypeEnum.COMMUNICATE_PLAN.getAlias()),
    COMMUNICATE(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getAlias()),
    CONTRACT(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.CONTRACT.getCode(), XbbRefTypeEnum.CONTRACT.getAlias()),
    SIGN_IN(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.SIGNIN.getCode(), XbbRefTypeEnum.SIGNIN.getAlias()),
    WORK_REPORT(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.WORK_REPORT.getCode(), XbbRefTypeEnum.WORK_REPORT.getAlias()),
    QUOTATION(XbbRefTypeEnum.CRM.getCode(), XbbRefTypeEnum.QUOTATION.getCode(), XbbRefTypeEnum.QUOTATION.getAlias()),

    /**
     * FundManagement
     */
    PAYMENT(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PAYMENT.getCode(), XbbRefTypeEnum.PAYMENT.getAlias()),
    PAYMENT_SHEET(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PAYMENT_SHEET.getCode(), XbbRefTypeEnum.PAYMENT_SHEET.getAlias()),
    RED_PAYMENT_SHEET(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.RED_PAYMENT_SHEET.getCode(), XbbRefTypeEnum.RED_PAYMENT_SHEET.getAlias()),
    BAD_DEPT(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.BAD_DEBT.getCode(), XbbRefTypeEnum.BAD_DEBT.getAlias()),
    PREPAYMENT(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PREPAYMENT.getCode(), XbbRefTypeEnum.PREPAYMENT.getAlias()),
    RED_PREPAYMENT(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.RED_PREPAYMENT.getCode(), XbbRefTypeEnum.RED_PREPAYMENT.getAlias()),
    PAY_PLAN(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PAY_PLAN.getCode(), XbbRefTypeEnum.PAY_PLAN.getAlias()),
    PAY_SHEET(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PAY_SHEET.getCode(), XbbRefTypeEnum.PAY_SHEET.getAlias()),
    PREPAY(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PREPAY.getCode(), XbbRefTypeEnum.PREPAY.getAlias()),
    RED_PAY_SHEET(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.RED_WRITE_OFF_PAY.getCode(), XbbRefTypeEnum.RED_WRITE_OFF_PAY.getAlias()),
    RED_PREPAY(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.RED_PREPAY.getCode(), XbbRefTypeEnum.RED_PREPAY.getAlias()),
    BAD_PAY(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.BAD_PAY.getCode(), XbbRefTypeEnum.BAD_PAY.getAlias()),
    INVOICE(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.INVOICE.getCode(), XbbRefTypeEnum.INVOICE.getAlias()),
    RED_INVOICE(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.RED_INVOICE.getCode(), XbbRefTypeEnum.RED_INVOICE.getAlias()),
    PURCHASE_INVOICE(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), XbbRefTypeEnum.PURCHASE_INVOICE.getAlias()),
    RED_PURCHASE_INVOICE(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.RED_PURCHASE_INVOICE.getCode(), XbbRefTypeEnum.RED_PURCHASE_INVOICE.getAlias()),
    CUSTOMER_STATEMENT_STATISTIC(XbbRefTypeEnum.FUND_MANAGEMENT.getCode(), XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(), XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getAlias()),

    /**
     * WorkOrder
     */
    WORK_ORDER(XbbRefTypeEnum.WORK_ORDER.getCode(), XbbRefTypeEnum.WORK_ORDER.getCode(), XbbRefTypeEnum.WORK_ORDER.getAlias()),

    /**
     * MarketManagement
     */
    CLUE(XbbRefTypeEnum.MARKET_MANAGEMENT.getCode(), XbbRefTypeEnum.CLUE.getCode(), XbbRefTypeEnum.CLUE.getAlias()),

    /**
     * Distributor
     */
    DISTRIBUTOR(XbbRefTypeEnum.DISTRIBUTOR.getCode(), XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getAlias()),
    DISTRIBUTOR_CONTACT(XbbRefTypeEnum.DISTRIBUTOR.getCode(), XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getCode(), XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getAlias()),
    DISTRIBUTOR_COMMUNICATE(XbbRefTypeEnum.DISTRIBUTOR.getCode(), XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getCode(), XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getAlias()),

    /**
     * OrderCenter
     */
    ORDER(XbbRefTypeEnum.ORDER_CENTER.getCode(), XbbRefTypeEnum.ORDER.getCode(), XbbRefTypeEnum.ORDER.getAlias()),

    /**
     * WorkOrderV2
     */
    WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2_CENTER.getCode(), XbbRefTypeEnum.WORK_ORDER_V2.getCode(), XbbRefTypeEnum.WORK_ORDER_V2.getAlias()),

    /**
     * Unknown
     */
    UNKNOWN(XbbRefTypeEnum.UNKNOWN.getCode(), XbbRefTypeEnum.UNKNOWN.getCode(), XbbRefTypeEnum.UNKNOWN.getAlias()),

    ;


    /**
     * 父Code
     */
    private final Integer parentCode;

    /**
     * Code
     */
    private final Integer code;

    /**
     * 别名
     */
    private final String alias;

    /**
     * 根据Code获取枚举
     *
     * @param code
     * @return
     */
    public static PushParentTypeEnum getByCode(Integer code) {
        for (PushParentTypeEnum pushParentTypeEnum : values()) {
            if (pushParentTypeEnum.getCode().equals(code)) {
                return pushParentTypeEnum;
            }
        }
        return UNKNOWN;
    }

}
